@import '../../styles/var.less';

.k-calendar {
  display: inline-block;
  user-select: none;
  color: var(--kui-color-font);
  min-width: 272px;

  // box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  &+.k-calendar {
    border-left: solid 1px var(--kui-color-border);
  }

  .k-btn {
    transition: none;
  }

  .k-calendar-body {
    // width: 215px;
    position: relative;
    min-height: 262px;
    // min-width: 272px;
    padding: 0 10px 10px 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  .k-calendar-head {
    text-align: center;
    position: relative;
    padding: 10px;
    display: flex;
    align-items: center;

    .k-calendar-year-select,
    .k-calendar-month-select,
    .k-calendar-day-select {
      font-size: 14px;
      // padding: 0 2px;
      position: relative;
      font-weight: bold;
      flex: 1;
    }

  }

  .k-calendar-time-label {
    flex: 1;
    font-size: 14px;
  }

  .k-calendar-yearmonth-picker {
    display: flex;
    height: 262px;
  }

  .k-calendar-years,
  .k-calendar-months {

    &::before,
    &::after {
      content: '';
      display: block;
      width: 100%;
    }

    &::before {
      height: 110px;
    }

    &::after {
      height: 130px;
    }

    // width: 50%;
    height: 100%;
    flex:1;
    // position: absolute;
    background: var(--kui-color-control-10);
    // top: 0;
    font-size: 0;
    text-align: center;
    box-sizing: border-box;
    overflow: auto;
    border-top: 1px solid var(--kui-color-border);

    &::-webkit-scrollbar {
      height: 0;
      width: 0;
    }

    span {
      font-size: 14px;
      width: auto;
      display: block;
      margin: 0;
      padding: 0;
      text-align: center;
      height: 36px;
      line-height: 36px;
      box-sizing: border-box;
      // margin: 8px;
      // border-radius: var(--kui-border-radius);
      position: relative;
      cursor: pointer;

      &:hover {
        background-color: var(--kui-color-hover);
      }

      &:active {
        background-color: var(--kui-color-active);
      }
    }

    .k-calendar-item-selected {
      background-color: var(--kui-color-main-90);

      &:hover {
        background-color: var(--kui-color-main-90);
      }
    }
  }

  .k-calendar-months {
    border-left: 1px solid var(--kui-color-border);
  }

  .k-calendar-weekdays {
    font-weight: 500;
    // border-bottom: 1px solid var(--kui-color-border);

    .k-calendar-weekday {
      width: 36px;
      height: 36px;
      display: inline-block;
      text-align: center;
      line-height: 36px;
      color: var(--kui-color-icon);
      font-size: 12px;
    }
  }

  .k-calendar-week-item {
    display: flex;
    align-items: center;
  }

  .k-calendar-day-item {
    cursor: pointer;
    color: var(--kui-color-font);
    border-radius: var(--kui-border-radius);
    position: relative;
    display: inline-block;
    text-align: center;
    overflow: hidden;
    border: 1px solid transparent;
    width: 32px;
    height: 32px;
    line-height: 32px;
    font-size: 14px;
    margin: 2px;
    box-sizing: border-box;

    &:hover {
      background: var(--kui-color-hover);
    }

    &:active {
      background: var(--kui-color-active);
    }
  }

  .k-calendar-day-out {
    color: var(--kui-color-icon);
    background: none;
  }

  .k-calendar-day-in {
    // color: var(--kui-color-main-80);
    background: var(--kui-color-main-90);
  }

  // .k-calendar-year-this,
  // .k-calendar-month-this,
  .k-calendar-day-this {
    // border: 1px solid var(--kui-color-main);
    color: var(--kui-color-main);
    background-color: var(--kui-color-gray-90);

    &:after {
      content: '';
      position: absolute;
      width: 5px;
      height: 5px;
      background: var(--kui-color-main);
      right: 1px;
      top: 1px;
      border-radius: 50%;
    }
  }

  .k-calendar-day-selected {
    color: #fff;
    font-weight: bold;
    background: var(--kui-color-main);
    border-radius: var(--kui-border-radius);

    &:hover {
      background: var(--kui-color-main);
    }
  }

  .k-calendar-year-disabled,
  .k-calendar-month-disabled {
    cursor: not-allowed;
    color: var(--kui-color-disable-color);
    background: var(--kui-color-disable-back);
  }

  //day
  .k-calendar-day-disabled {
    cursor: not-allowed;
    color: var(--kui-color-disable-color);
    background: var(--kui-color-disable-back);

    &.k-calendar-day-this {
      border-color: var(--kui-color-disable-border);

      &::after {
        background: var(--kui-color-disable-border);
      }
    }

    &:hover {
      background: var(--kui-color-disable-back);
    }
  }

  .k-calendar-time-picker {
    width: 100%;
    height: 262px;
    background: var(--kui-color-control-10);
    border-top: 1px solid var(--kui-color-border);
    display: flex;
    margin-top: -1px;

    .k-calendar-time-picker-select {
      flex: 1;
      overflow: auto;
      height: 100%;
      border-right: 1px solid var(--kui-color-border);
      box-sizing: border-box;

      &::before,
      &::after {
        content: '';
        display: block;
        width: 100%;
        height: 127px;
      }

      &::-webkit-scrollbar {
        width: 0;
        height: 0;
      }

      &:last-child {
        border: none;
      }

    }

    .k-calendar-time-item {
      display: block;
      font-size: 14px;
      box-sizing: content-box;
      width: 100%;
      height: 36px;
      margin: 0;
      padding: 0;
      text-align: center;
      line-height: 36px;
      list-style: none;
      cursor: pointer;
      transition: all .3s;

      &:hover {
        background: var(--kui-color-hover);
      }

      &:active {
        background: var(--kui-color-active);
      }

    }

    .k-calendar-item-selected {
      // color: var(--kui-color-main);
      // font-weight: bold;
      background: var(--kui-color-main-90);

      &:hover {
        background: var(--kui-color-main-90);
      }
    }

    .k-calendar-time-disabled {
      color: var(--kui-color-disable-color);
      cursor: not-allowed;
    }

  }

  .k-calendar-footer {
    border-top: 1px solid var(--kui-color-border);
    position: relative;
    z-index: 1;
    padding: 5px 8px;
    text-align: right;
    box-sizing: border-box;

    // height: 26px;
    .k-btn {
      cursor: pointer;
    }

    .k-calendar-btn-ok {
      margin-left: 8px;
    }
  }
}

.k-calendar-yearmonth,
.k-calendar-only-year {
  min-width: 135px;
}

.k-calendar-only-time {
  min-width: 180px;
}

.k-calendar-small {
  min-width: 216px;

  .k-calendar-body {
    width: 216px;
    min-height: 206px;
  }

  .k-calendar-time-picker,
  .k-calendar-yearmonth-picker {
    height: 206px;

    .k-calendar-time-item {
      font-size: 12px;
      height: 24px;
      line-height: 24px;
    }
  }

  .k-calendar-head {
    padding: 8px;

    .k-btn {
      font-size: 12px;
    }
  }

  .k-calendar-weekdays {
    box-sizing: border-box;

    .k-calendar-weekday {
      width: 28px;
      height: 28px;
      line-height: 28px;
    }
  }

  .k-calendar-week-item {
    box-sizing: border-box;
  }

  .k-calendar-day-item {
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 12px;
  }

  .k-calendar-years,
  .k-calendar-months {

    &::after,
    &::before {
      height: 91.5px;
    }

    span {
      height: 24px;
      line-height: 24px;
      font-size: 12px;
    }
  }
}